window: Fix up resize borders
authorMatthias Clasen <mclasen@redhat.com>
Thu, 22 Apr 2021 00:00:49 +0000 (20:00 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 22 Apr 2021 00:09:38 +0000 (20:09 -0400)
The invisible resize borders have been wider than they
should, for a while. Go back to a size close to what
we have in GTK3.

To summarize: resize borders will be at most 12 pixels
on each size, but never wider than the windows shadow.
The resize corners have 'legs' of 24 pixels where you
still get a corner resize cursor.

Fixes: #3856
gtk/gtkwindow.c

index 17beb19fa364302e1b4968e20afc6031f9941d2d..22706903570aaae7f90c03a71ad18918f121c29d 100644 (file)
  */
 
 #define MENU_BAR_ACCEL GDK_KEY_F10
-#define RESIZE_HANDLE_SIZE 20
+#define RESIZE_HANDLE_SIZE 12 /* Width of resize borders */
+#define RESIZE_HANDLE_CORNER_SIZE 24 /* How resize corners extend */
 #define MNEMONICS_DELAY 300 /* ms */
 #define NO_CONTENT_CHILD_NAT 200 /* ms */
 #define VISIBLE_FOCUS_DURATION 3 /* s */
@@ -1389,10 +1390,10 @@ get_edge_for_coordinates (GtkWindow *window,
 
   if (x < left && x >= left - handle_size.left)
     {
-      if (y < top + handle_size.top && y >= top - handle_size.top)
+      if (y < top + RESIZE_HANDLE_CORNER_SIZE && y >= top - handle_size.top)
         return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
 
-      if (y > top + border_rect->size.height - handle_size.bottom &&
+      if (y > top + border_rect->size.height - RESIZE_HANDLE_CORNER_SIZE &&
           y <= top + border_rect->size.height + handle_size.bottom)
         return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
 
@@ -1401,10 +1402,10 @@ get_edge_for_coordinates (GtkWindow *window,
   else if (x > left + border_rect->size.width &&
            x <= left + border_rect->size.width + handle_size.right)
     {
-      if (y < top + handle_size.top && y >= top - handle_size.top)
+      if (y < top + RESIZE_HANDLE_CORNER_SIZE && y >= top - handle_size.top)
         return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
 
-      if (y > top + border_rect->size.height - handle_size.bottom &&
+      if (y > top + border_rect->size.height - RESIZE_HANDLE_CORNER_SIZE &&
           y <= top + border_rect->size.height + handle_size.bottom)
         return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);
 
@@ -1412,10 +1413,10 @@ get_edge_for_coordinates (GtkWindow *window,
     }
   else if (y < top && y >= top - handle_size.top)
     {
-      if (x < left + handle_size.left && x >= left - handle_size.left)
+      if (x < left + RESIZE_HANDLE_CORNER_SIZE && x >= left - handle_size.left)
         return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
 
-      if (x > left + border_rect->size.width - handle_size.right &&
+      if (x > left + border_rect->size.width - RESIZE_HANDLE_CORNER_SIZE &&
           x <= left + border_rect->size.width + handle_size.right)
         return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
 
@@ -1424,10 +1425,10 @@ get_edge_for_coordinates (GtkWindow *window,
   else if (y > top + border_rect->size.height &&
            y <= top + border_rect->size.height + handle_size.bottom)
     {
-      if (x < left + handle_size.left && x >= left - handle_size.left)
+      if (x < left + RESIZE_HANDLE_CORNER_SIZE && x >= left - handle_size.left)
         return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
 
-      if (x > left + border_rect->size.width - handle_size.right &&
+      if (x > left + border_rect->size.width - RESIZE_HANDLE_CORNER_SIZE &&
           x <= left + border_rect->size.width + handle_size.right)
         return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);